{% extends 'base.html' %}
{% load static %}
{% block content %}
<div class="row justify-content-center mt-5">
    <div class="col-md-6">
        <div class="card">
            <div class="card-header bg-primary text-white">
                <h3 class="card-title text-center">登录</h3>
            </div>
            <div class="card-body">
                <form method="post">
                    {% csrf_token %}
                    <div class="mb-3">
                        <label for="username" class="form-label">用户名</label>
                        <input type="text" class="form-control" id="username" name="username" required>
                    </div>
                    <div class="mb-3">
                        <label for="password" class="form-label">密码</label>
                        <input type="password" class="form-control" id="password" name="password" required>
                    </div>
                    <button type="submit" class="btn btn-primary w-100">登录</button>
                </form>
                {% if form.errors %}
                <div class="alert alert-danger mt-3">
                    用户名或密码错误，请重试。
                </div>
                {% endif %}
            </div>
            <div class="card-footer text-center">
                <a href="{% url 'register' %}" class="text-decoration-none">没有账号？立即注册</a>
            </div>
        </div>
    </div>
</div>
{% endblock %}